from django.db import models


# Create your models here.


class Users(models.Model):
    username = models.CharField(max_length=16)
    password = models.CharField(max_length=16)


class Friendship(models.Model):
    users_a = models.CharField(max_length=16)
    users_b = models.CharField(max_length=16)
    is_requested = models.BooleanField(default=False)
    is_accepted = models.BooleanField(default=False)

    def __str__(self):
        return f"{self.users_a} - {self.users_b}"


class Group(models.Model):
    groupname = models.CharField(max_length=255)
    user = models.ManyToManyField(to='Users')
    Singlechat = models.BooleanField(default=True)
    chat = models.ForeignKey(to="Chat", on_delete=models.CASCADE)


class Groupname(models.Model):
    name = models.CharField(max_length=25)
    user = models.ManyToManyField(to='Users')


class Chat(models.Model):
    username = models.CharField(max_length=16)
    msg = models.TextField()
    msg_date = models.DateTimeField(auto_now_add=True)
